package com.dao;

import java.util.List;

import com.entity.Brand;
import com.entity.City;
import com.entity.ImageInfo;
import com.util.Page;
/**
 * 品牌信息
 * @author tiger
 *
 */
public class ImageDao extends BaseDAO {
	
	/**
	 * 查询所有
	 * @return
	 * @throws Exception
	 */
	public List findImageList() throws Exception{
		return this.queryObject(ImageInfo.class);
	}
	
	
	/**
	 * 按客户查询
	 * @return
	 * @throws Exception
	 */
	public List<ImageInfo> findImageListByClientId(int clientid) throws Exception{
		return this.queryObject(ImageInfo.class,"where clientid=?",clientid);
	}
	
	/**
	 * 按ID查询单个对象
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public ImageInfo findImageInfoById(String id) throws Exception{
		ImageInfo ImageInfo = null;
		ImageInfo = (ImageInfo) this.queryByObjectId(ImageInfo.class, "where :id=?",id);
		return ImageInfo;
	}	
	
	/**
	 * 删除多条信息
	 * @param ids
	 * @return
	 */
	public boolean delImageInfos(String ids){
		String sql = "delete from ImageInfos where id in ("+ids+")";
		return this.executeUpdate(sql);
	}
	
	/**
	 * 删除单条信息
	 * @param obj
	 * @return
	 */
	public boolean delImageInfo(Object obj){
		return this.deleteObject(obj);
	}
	
	/**
	 * 更新信息
	 * @param sql
	 * @return
	 */
	public boolean updateImageInfo(String sql){
		return this.executeUpdate(sql);
	}
	

	/**
	 * 按分页查询
	 * @param page
	 * @return
	 * @throws Exception
	 */
	public Page findbyPage(Page page) throws Exception{
		return this.queryObjectForPage(ImageInfo.class, page);
	}

	/**
	 * 保存信息
	 * @param info
	 * @return
	 */
	public boolean save(ImageInfo info) {
		return this.saveObject(info);
	}
}
